#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
struct ss
{
	int x;
	int t;
	int v;
}a[110];
bool cmp(ss x, ss y)
{
	return x.v > y.v;
}
int main()
{
	int q;
	cin >> q;
	while (q--)
	{
		int n, time;
		cin >> n >> time;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i].t;
			a[i].x = i;
		}
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i].v;
		}
		sort(a + 1, a + n + 1, cmp);
		int f = 1;
		for (int i = 1; i <= n; i++)
		{
			if ((a[i].x - 2) + a[i].t < time)
			{
				f = 0;
				cout << a[i].x << endl;
				break;
			}
		}
		if (f) cout << -1 << endl;
	}
	return 0;
}